import OpenAI, { modelConfigs as openaiModel } from './openai'
import Ollama, { modelConfigs as ollamaModel } from './ollama'
import Gemini, { modelConfigs as geminiModel } from './gemini'
import { APIProvider, Assistant, ChatOptions } from '@/types'

export function getAssistant(config: Assistant & ChatOptions) {
  if (config.modelApi == APIProvider.OpenAI) {
    return new OpenAI(config)
  }
  else if (config.modelApi == APIProvider.Gemini) {
    return new Gemini(config)
  }
  else {
    return new Ollama(config)
  }
}

export const modelTypes = {
  [APIProvider.OpenAI]: {
    title: 'OpenAI API',
    desc: 'Support OpenAI,Openrouter,Groq',
    models: openaiModel,
  },
  [APIProvider.Ollama]: {
    title: 'Ollama API',
    desc: 'Support Ollama API',
    models: ollamaModel,
  },
  [APIProvider.Gemini]: {
    title: 'Gemini API',
    desc: 'Support Gemini API',
    models: geminiModel,
  },
}

export type AssistantType = OpenAI | Ollama | Gemini
